<#assign className = table.className>
<#assign classNameLower = className?uncap_first>
<#assign classNameCap = className?lower_case?cap_first>
package ${basepackage}.service.impl;

import java.util.List;
import java.util.stream.Collectors;

import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import cn.hutool.core.bean.BeanUtil;
import ${basepackage}.framework.model.PageData;
import ${basepackage}.framework.model.PageParam;
import ${basepackage}.entity.${className};
import ${basepackage}.model.${className}Model;
import ${basepackage}.dao.${className}Mapper;
import ${basepackage}.service.${className}Service;
import ${basepackage}.framework.generic.GenericServiceImpl;

/**
 * ${className}服务实现
 */
@Service
@Transactional
public class ${className}ServiceImpl extends GenericServiceImpl<${className}> implements ${className}Service{
	
	@Autowired
	private ${className}Mapper mapper;
	
	@Override
	public ${className}Model getDetail(Integer id) {
		${className}Model model = new ${className}Model();
		${className} record = mapper.selectById(id);
		BeanUtil.copyProperties(record, model);
		return model;
	}
	
	@Override
	public PageData<${className}Model> page(PageParam param) {
		PageData<${className}> data = super.getPageData(param);

		List<${className}Model> list = data.getList().stream().map(a -> {
			${className}Model dto = new ${className}Model();
			BeanUtils.copyProperties(a, dto);
			return dto;
		}).collect(Collectors.toList());

		PageData<${className}Model> result = new PageData<${className}Model>();
		BeanUtils.copyProperties(data, result);
		result.setList(list);
		return result;
	}


}
